<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>变量和和函数同名的的问题</title>
</head>

<body>
  <script>

    // var a = 1;
    // function a() { }
    // alert(a);//1

    // 预解析
    // var a;
    // function a(){}
    // a = 1;
    // alert(a)

    function show(a) {
      function a() { }
      var a = 1;
      alert(a); // 1
    }
    show(2)
  </script>
</body>

</html>